class User < ActiveRecord::Base
  validates_presence_of :login, :password, :email
  validates_length_of :login, :minimum => 5
  validates_length_of :login, :maximum => 25
  validates_length_of :password, :minimum => 10
  validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
  validates_format_of :login, :with => /^[\w_-]+$/i
  validates_uniqueness_of :login
  validates_uniqueness_of :email, :message => "is already registered by another user"
  
  has_many :domains
  
  accepts_nested_attributes_for :domains
end
